<template>
<div id="wrapper">
    <div class="page-address-list" data-log="地址列表">
        <div class="address-choose">
            <ul class="ui-list">
                <li class="ui-list-item" v-for="address in addresses">
                  <p class="ui_fz30"><span class="consignee">{{address.name}}</span><span>{{address.tel}}</span>
                </p>
                    <p>{{address.province}} {{address.city}} {{address.area}}</p>
                    <p>{{address.detail}}</p></li>
            </ul>
        </div>
      <router-link :to="{name:'Address_create'}">
        <div class="add"><a href="javascript:;" class="ui-button ui-button-active"><span>新建地址</span></a></div></router-link>
        <div class="popup-risk-check"></div>
    </div>
</div>
</template>
<script>

  export default {

    data() {
      return {

        addresses:[]

      }
    },
    created() {
      this.init();
    },
    methods: {
      init() {
        this.axios.get(`/address/address_list?token=${localStorage.token}`)
          .then((response) => {
            // console.log(response.data);
            this.addresses = response.data.addresses;
          })

        // .catch((error)=>{
        //   console.log(error.response.data.error)
        // if(error.response.data.error=='token_invalid'){
        //     alert('非法登录')
        //   this.$router.push({name:'Login'})
        // }
        // })
      },
    },
  }
</script>

